﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpenseSystem.Common;
using ExpenseSystem.Common.BaseModel;
using ExpenseSystem.DataUpdater;
using ExpenseSystem.Fether;
using ExpenseSystem.Model;
using ExpenseSystem.Core.DataAddOn;
using System.Web;

namespace ExpenseSystem.Core.OrderModules
{
    public class OrderTypeManager : INormalManager<OrderTypeModel>
    {
        protected string tran = HttpContext.Current.Items[Definition.SESSION_TRAN_STR].ToString();

        protected UserProfile profile = Authority.Authority.GetUserProfile();
        OrderTypeFetcher fetcher = new OrderTypeFetcher();
        protected NormalDataUpdater<OrderTypeModel> OrderTypeUpdater = new OrderTypeUpdaterRegister().GetOrderTypeUpdater();

        public virtual bool Delete(OrderTypeModel role, out string message)
        {

            bool result = OrderTypeUpdater.Remove(role, tran, fetcher, out message);
            return result;
        }
        public virtual bool DeleteById( long[] OrderTypeId,  out string message)
        {

            bool result = true;
            result = OrderTypeUpdater.RemoveById(profile.SiteId, OrderTypeId, tran, fetcher, out message);
            return result;
        }
        public virtual bool Save(OrderTypeModel OrderType,  out string message, params IAddable<OrderTypeModel>[] addables)
        {

            return OrderTypeUpdater.Save(OrderType, tran, fetcher, out message);
        }

    }
}
